import random

strs = 'abcdefghijklmnopqrstuvwxyz'
a = [''.join(random.sample(strs,2)) for _ in range(100)]
d = {}
for x in a:
    if x not in d:
        d.setdefault(x, 1)
    else:
        d[x] += 1
print(sorted([(v,k) for k,v in d.items()],reverse=True))

